feat(rsa): in-place RSA update + corrected learning-reset warning (split 4/4 of #34)#53
Open
illia-sapryga wants to merge 2 commits into
Open
feat(rsa): in-place RSA update + corrected learning-reset warning (split 4/4 of #34)#53illia-sapryga wants to merge 2 commits into
illia-sapryga wants to merge 2 commits into
Conversation
Pull the headline/description content validation (count, char limits, pin-slot rules) out of _validate_rsa into a standalone _validate_rsa_assets(headlines, descriptions, enforce_headline_count, enforce_description_count). draft_responsive_search_ad's _validate_rsa now delegates to it with both counts enforced. The enforce flags let a caller validate only the list(s) it is actually sending — needed by the upcoming in-place RSA update, where an omitted headline or description list stays untouched on the live ad and must not be gated on the 3-15 / 2-4 count. Claude-Session: https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s
…ing-reset warning Add update_responsive_search_ad: mutate an existing RSA's headlines, descriptions, final_url, path1, or path2 in place via AdService.MutateAds (the ad keeps its ID). Uses a sparse FieldMask carrying only the changed field paths; headlines/descriptions are list-replace and validated through the shared _validate_rsa_assets, enforcing the count only on the list being sent. Registers the tool, adds _apply_update_rsa and the _execute_plan dispatch entry. CRITICAL correctness fix over the original kLOsk#42 framing: replacing an RSA's headlines or descriptions is NOT a free in-place edit. Even though the ad ID is preserved, Google treats the creative as new — it resets the ad's asset-combination learning and performance history and re-triggers policy review. The docstrings state this plainly (dropping the inverted 'no learning-period reset' claim), and the preview attaches a prominent warning whenever headlines/descriptions are replaced. URL/path-only edits do not carry the warning, since they are genuine in-place changes. Tests: full fake-client coverage (validation, plan construction, sparse FieldMask apply, confirm_and_apply integration, headline/description mutation) plus warning presence/absence assertions, and a server-level runtime-config call-through. All data scrubbed to example.com / generic copy. Claude-Session: https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s
This was referenced Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split 4/4 of #34 — RSA in-place update (folds in #42)
Final split. Independent (off
main), registers only its own tool.Refactor + tool
_validate_rsa_assets(headlines, descriptions, enforce_headline_count=True, enforce_description_count=True)from_validate_rsa.draft_responsive_search_adkeeps both enforce flags on;update_responsive_search_adsetsenforce_*_count=bool(list_provided)so it only gates the list(s) actually being replaced.update_responsive_search_ad— in-place mutate ofheadlines/descriptions/final_url/path1/path2(+clear_path1/clear_path2)._apply_update_rsa—AdService.ad_path(plain ad ID), sparse FieldMask (only changed paths), list-replace headlines/descriptions with pin handling. (These are the mechanics you reviewed as correct.)The fix you asked for — corrected the inverted claim
The #42 version claimed the in-place edit avoided a learning reset. That's backwards. Corrected everywhere (impl + server + apply docstrings), and added a preview warning that fires only when headlines/descriptions are actually being replaced:
TestLearningResetWarningproves it's present for headlines-replaced / descriptions-replaced / headlines+URL-mixed, and absent for URL-only, path-only, and clear-path-only edits.v0.12 compliance
current_config()in the wrapper (stale-_configgrep guard passes)._StrOrDictListOptcoercion alias soheadlines/descriptionsaccept plain strings or{text, pinned_field}dicts while being optional.(client, cid, changes); tests useset_plan_store(InMemoryPlanStore()).Tests & hygiene
example.comURLs, generic retail copy, no real client data.This completes the four-way split of #34: (a) #50, (b) #51, (c) #52, (d) here. #42 and #43 can be closed in favor of these — say the word if you'd rather keep them open for reference.
https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s